package day13;

import java.awt.GridLayout;

import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollPane;

public class JFrameDemo7 {
	public static void main(String[] args) {
		JFrame frame = new JFrame("选择");
		JPanel panel = new JPanel();
		frame.add(panel);
		panel.setLayout(new GridLayout(2, 1));
		JPanel panel1 = new JPanel();
		JLabel label1 = new JLabel("你的籍贯：");
		String[] homes = {"北京","上海","广州","深圳","青岛"};
		JComboBox comboBox = new JComboBox(homes);
		panel1.add(label1);
		panel1.add(comboBox);
		JPanel panel2 = new JPanel();
		JLabel label2 = new JLabel("xuexi：");
		String[] langues = {"Java","PHP","Python","Android","C","C++","Html"};
		JList<String> list = new JList<>(langues);
		list.setVisibleRowCount(3);
		JScrollPane scrollPane = new JScrollPane(list);
		panel2.add(label2);
		panel2.add(scrollPane);
		panel.add(panel1);
		panel.add(panel2);
		frame.setSize(500, 400);
		frame.setLocation(450, 450);
		frame.setVisible(true);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	}
}
